package com.jike.noobmoney.mvp.view.activity;

import android.content.Intent;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

import com.jike.noobmoney.R;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Create by xuke on 2018/11/10
 * 编辑姓名
 */
public class EditNameActivity extends BaseActivity {


    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.tv_baocun)
    TextView tvBaocun;
    @BindView(R.id.et_name)
    EditText etName;

    @Override
    protected int layoutResID() {
        return R.layout.activity_edit_name;
    }

    @Override
    protected void initData() {
        String name = getIntent().getStringExtra("name");
        etName.setText(name);
    }


    @OnClick({R.id.iv_back, R.id.tv_baocun})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.tv_baocun:
                String newName = etName.getText().toString().trim();
                Intent intent = new Intent();
                intent.putExtra("newName", newName);
                setResult(200, intent);
                finish();
                break;
        }
    }
}
